@extends('public.main')
@section('title')
    {{ strip_tags($test->title) }}
@endsection

@section('css')
    <link rel="stylesheet" type="text/css" href="{{ asset('/static/css/detail.css') }}">
@endsection

@section('content')
<div class="col-sm-12 col-xs-12">
    <div class="col-sm-12 col-xs-12" style="margin:0px;padding:0px;">
        <div class="col-sm-12 col-xs-12 content_left" style="margin:0px;padding:0px;">
            <div class="col-sm-12 col-xs-12 item_article">
                <div class="col-sm-12 col-xs-12" style="margin:0;padding:0;margin-top:10px ">
                    {{--<div class="avatar">
                        <img src="{{ asset('/static/img/32.png') }}"/>
                    </div>
                    <div class="user_name">
                        <a href="#" style="color:#9b8878;" id="username">大吴和毛毛</a>
                    </div>--}}
                    <h3>
                        {{ $test->title }}
                    </h3>
                </div>
                <div style="display:none" id="test_id">{{ $test->id }}</div>
                <div class="col-sm-12 col-xs-12 item_content" style="position:relative;">
                    @if( $test->imgurl!=null )
                        <div class="col-sm-12 col-xs-12" style="background:url({{ asset($test->imgurl) }}) no-repeat;height:500px;text-align:center;">
                            <button type="button" class="btn btn-info btn-lg" style="margin-top:200px;"  data-toggle="modal" data-target="#myModal1">戳我开始</button>
                        </div>
                    @endif
                    <!-- Modal -->
                        <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-body">
                                        <div class="row" id="before_look">
                                            <div class="col-md-6 col-xs-6">
                                                <img src="{{ asset("/img/fxh.jpg") }}"/>
                                            </div>
                                            <div class="col-md-6 col-xs-6">
                                                <h4>经分析：</h4>
                                                <div style="margin-top:10px;margin-bottom:10px;">
                                                    <textarea class="form-control" rows="3" placeholder="可以选择把内容分享到社交平台哦～"></textarea>
                                                </div>
                                                <div>
                                                    {{--<button class="btn btn-success" >查看结果并分享</button>--}}
                                                    {{--<wb:share-button appkey="4056993719" addition="simple" type="button" default_text="{{ $testResult->result }}"></wb:share-button>--}}
                                                    <a id="shareBtn" class="btn btn-success">查看结果并分享</a>
                                                    <button class="btn btn-default" onclick="onlyResult()">只查看结果</button>
                                                </div>
                                                <div>
                                                    <img src="{{ asset("/img/resaulttip.jpg") }}"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row" id="after_look" style="display:none;">
                                            <div class="col-md-6 col-xs-6">
                                                <img src="{{ asset("/img/fxh.jpg") }}"/>
                                            </div>
                                            <div class="col-md-6 col-xs-6">
                                                <h4>经分析：</h4>
                                                <div id="result_text"></div>
                                                <div style="margin-top:10px;margin-bottom:10px;">
                                                    <textarea class="form-control" rows="3" placeholder="可以选择把内容分享到社交平台哦～"></textarea>
                                                </div>
                                                <div>
                                                    <button type="button" class="btn btn-default" onclick="close_modal()">关闭</button>
                                                </div>
                                                <div>
                                                    <img src="{{ asset("/img/resaulttip2.jpg") }}"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    {{--<div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                        <button type="button" class="btn btn-primary">Save changes</button>
                                    </div>--}}
                                </div>
                            </div>
                        </div>
                    {{--@if( $test->imgurl!=null )
                        <div style="position:absolute;width:100%;height:100px;"><img src="{{ asset($test->imgurl) }}"/></div>
                    @endif
                    <div style="position:absolute">
                        <a type="button" class="btn btn-info" href="#">戳我开始</a>
                    </div>--}}
                </div>
                <div id="article_id" style="display:none;">{{ $test->id }}</div>
                <div class="col-sm-12 col-xs-12 detail_button">
                    <button type="button" class="col-sm-3 col-xs-3 btn btn-default" style="">上一条</button>
                    <button type="button" class="col-sm-6 col-xs-4 col-xs-offset-1 col-sm-offset-1 btn btn-default" style="background:black;color:white;">下一条</button>
                    <button type="button" class="col-sm-3 col-xs-3 col-xs-offset-1 col-sm-offset-1 btn btn-default" style="">收藏</button>
                </div>
                <div class="col-sm-12 col-xs-12 item_praise">
                    <div class="praise_first">
                        {{ $test->praise }} 好笑
                    </div>
                    <div class="praise_point">
                        ·
                    </div>
                    <div class="praise_second">
                        <a href="#" style="color:#999999" id="comment_num">107 评论</a>
                    </div>
                </div>
                <div class="col-sm-12 col-xs-12 item_img">
                    <div style="float:left;">
                        <a href="#"><img src="{{ asset('/static/img/good.png') }}" style="width:20px;height:20px;"/></a>
                        <a href="#"><img src="{{ asset('/static/img/bad.png') }}" style="width:20px;height:20px;margin-left:20px;"/></a>
                        <a href="#"><img src="{{ asset('/static/img/comments.png') }}" style="width:20px;height:20px;margin-left:20px;"/></a>
                    </div>
                    <div style="float:right;">
                        <a href="#"><img src="{{ asset('/static/img/qq-2.png') }}" style="width:20px;height:20px;"/></a>
                        <a href="#"><img src="{{ asset('/static/img/微信-2.png') }}" style="width:20px;height:20px;margin-left:20px;"/></a>
                    </div>
                </div>
                <div class="col-sm-12 col-xs-12">
                    <script type="text/javascript">
                        document.write('<a style="display:none!important" id="tanx-a-mm_56967596_36728993_131770358"></a>');
                        tanx_s = document.createElement("script");
                        tanx_s.type = "text/javascript";
                        tanx_s.charset = "gbk";
                        tanx_s.id = "tanx-s-mm_56967596_36728993_131770358";
                        tanx_s.async = true;
                        tanx_s.src = "http://p.tanx.com/ex?i=mm_56967596_36728993_131770358";
                        tanx_h = document.getElementsByTagName("head")[0];
                        if (tanx_h) tanx_h.insertBefore(tanx_s, tanx_h.firstChild);
                    </script>
                </div>
            </div>
        </div>
    </div>
    {{--<div class="col-md-4">
        <div class="col-md-12 content_right">
            <div class="col-md-12">
                <h4>快来扫一扫微信二维码，更多精彩内容等你来发现。</h4>
                <img src="http://7xj8tq.com1.z0.glb.clouddn.com/erweima1.jpg">
            </div>
            <div class="col-md-12">
                <iframe width="100%" height="400" class="share_self" frameborder="0" scrolling="no"
                        src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=400&fansRow=1&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=1&isFans=1&uid=5605043482&verifier=f260c920&dpc=1"></iframe>
            </div>
        </div>
    </div>--}}
</div>
@endsection

@section('script')
    <script src=http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=appkey type="text/javascript" charset="utf-8"></script>
    <script>
        var test_id=$('#test_id').text();
        function onlyResult(){
            $('#before_look').hide();
            $('#after_look').show();
            $.post('/test/getResult',{'testId':test_id},function(data){
                console.log(data);
                var data=JSON.parse(data);
                $('#result_text').text(data.result);
            })
        }
        function close_modal(){
            $('#myModal1').modal('hide');
            $('#before_look').show();
            $('#after_look').hide();
            $('#result_text').text("");
        }
        function weiboShare(){
            var wb_shareBtn = document.getElementById("shareBtn"),
                wb_url = document.URL, //获取当前页面地址，也可自定义例：wb_url = "http://www.bluesdream.com"
                wb_appkey = "",
                wb_title = "{{ $testResult->result }}",
                wb_ralateUid = "",
                wb_pic = "http://www.bluesdream.com/blog/wp-content/uploads/2013/01/CSS3-3D%E5%9B%BE%E4%B9%A6%E5%B1%95%E7%A4%BA-3D-Book-Showcase.jpg",
                wb_language = "zh_cn";

            wb_shareBtn.setAttribute("href","http://service.weibo.com/share/share.php?url="+wb_url+"&appkey="+wb_appkey+"&title="+wb_title+"&pic="+wb_pic+"&ralateUid="+wb_ralateUid+"&language="+wb_language+"");
        }
        weiboShare()
    </script>
@endsection

